package indi.zhifa.core.auth.handler;

import indi.zhifa.core.auth.properties.AuthProperties;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
@AllArgsConstructor
public class PasswdEncoderFactory {
    final AuthProperties passwdProperties;

    @Bean
    PasswordEncoder getPasswordEncoder(){
        return new BCryptPasswordEncoder(passwdProperties.getPasswd().getStrength());
    }
}
